/*
 * Sender.java
 *
 * Created on 18 lipiec 2007, 12:24
 *
 */

package pl.krakow.ae.knp.wikiboard.communication;

import java.io.IOException;
import java.io.ObjectOutputStream;
import pl.krakow.ae.knp.wikiboard.gui.board.BoardEvent;

/**
 *
 * @author slawek
 */
public class Sender extends Thread {
    
    private ObjectOutputStream out;
    
    /** Creates a new instance of Sender */
    public Sender(ObjectOutputStream out) {
        this.out = out;
        start();
    }
    
    public void run() {
        
    }
    
    public void sendEvent(BoardEvent event) {
        try {
            if(event != null)
                System.out.println("Wyslano obiekt");
            out.writeObject(event);
            out.flush();
            out.reset();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    
}
